package cn.hy.dataSync.transport.channel.disruptor;

import cn.hy.dataSync.element.Record;
import com.lmax.disruptor.EventHandler;

import java.util.concurrent.ArrayBlockingQueue;

public class RecordEventHandler implements EventHandler<RecordEvent> {

    private ArrayBlockingQueue<Record> queue;

    public RecordEventHandler(ArrayBlockingQueue<Record> queue) {
        this.queue = queue;
    }

    @Override
    public void onEvent(RecordEvent event, long sequence, boolean endOfBatch) throws Exception {
        queue.put(event.getRecord());
    }
}
